<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
//  统计某一字符或字符串在另一个字符串中出现的次数const 

var str = 'aabbcaacddaabbccdd'
var str2 = 'aa'
var childInNums = str.split(str2).length - 1
console.log(childInNums);
  </script>
</body>
</html>